package Example.immutable;

import com.google.common.collect.Maps;
import annoations.NotThreadSafe;

import java.util.Map;

/**
 * @author Wang Renlei
 * @Date 2020/7/2
 */
@NotThreadSafe
public class ImmutableExample1 {

    private final static Integer a = 1;

    private final static String b = "2";
    private final static Map<Integer, Integer> map = Maps.newHashMap();

    static {
        map.put(1, 2);
        map.put(3, 4);
        map.put(5, 6);
    }

    public static void main(String[] args) {
        //基本类型不允许修改值
//        a = 3;
//        b = "4";
        //引用类型不允许创建新的对象
//        map = Maps.newHashMap();


        System.out.println(map.get(3));
    }

}
